# $Id: PKGBUILD 174993 2013-01-10 02:03:14Z eric $
# Maintainer : Ionut Biru <ibiru@archlinux.org>
# Contributor: Douglas Soares de Andrade <douglas@archlinux.org>

pkgbase=zope-interface
pkgname=('python-zope-interface' 'python2-zope-interface')
pkgver=4.0.3
pkgrel=1
license=('ZPL')
arch=('any')
url="http://pypi.python.org/pypi/zope.interface"
makedepends=('python-distribute' 'python2-distribute')
source=(http://pypi.python.org/packages/source/z/zope.interface/zope.interface-${pkgver}.tar.gz)
md5sums=('1ddd308f2c83703accd1696158c300eb')

build() {
  cd "${srcdir}"
  cp -a zope.interface-${pkgver}{,-python2}

  #build python3 module
  cd "${srcdir}/zope.interface-${pkgver}"
  python setup.py build

  #build python2 module
  cd "${srcdir}/zope.interface-${pkgver}-python2"
  python2 setup.py build
}

check() {
  cd "${srcdir}/zope.interface-${pkgver}"
  python setup.py test

  cd "${srcdir}/zope.interface-${pkgver}-python2"
  python2 setup.py test
}

package_python-zope-interface() {
  pkgdesc=('Zope Interfaces for Python3')
  depends=('python')
  cd "${srcdir}/zope.interface-${pkgver}"
  python setup.py install --prefix=/usr --root="${pkgdir}" --optimize=1
  cp src/zope/__init__.py "${pkgdir}/usr/lib/python3.3/site-packages/zope/"
  #delete debug
  rm "${pkgdir}"/usr/lib/python3.3/site-packages/zope/interface/_zope_interface_coptimizations.cpython-33m.so
}

package_python2-zope-interface(){
  pkgdesc=('Zope Interfaces for Python2')
  depends=('python2')
  replaces=('zope-interface')
  provides=('zope-interface')
  cd "${srcdir}/zope.interface-${pkgver}-python2"
  python2 setup.py install --prefix=/usr --root="${pkgdir}" --optimize=1
  cp src/zope/__init__.py "${pkgdir}/usr/lib/python2.7/site-packages/zope/"
  #delete debug
  rm "${pkgdir}"/usr/lib/python2.7/site-packages/zope/interface/_zope_interface_coptimizations.so
}
